package com.happy.xiao.common.service.impl;


import com.happy.xiao.common.entity.UserBean;
import com.happy.xiao.common.repository.UserRepository;
import com.happy.xiao.common.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    UserRepository userRepository;

    public UserBean test() {
        return userRepository.getOne(30);
    }

    @Transactional
    public void addUser() {
        UserBean userBean = new UserBean("TestName",
                "$2y$10$jQAkySdYLY0R1/HCNNEdaePaQdm5tzU3WmuDdFImy5PPsRCTSt86C");
        userRepository.save(userBean);
    }
}
